package com.sp.decorator;

public class BufferedReader_ extends Reader_{

    private Reader_ reader_;//属性是Reader_类型

    //构造器里面接收Reader_子类对象
    public BufferedReader_(Reader_ reader_) {
        this.reader_ = reader_;
    }

    //封装一层
    public void  readFile() {
        reader_.readFile();
    }

    //让方法更加灵活, 多次读取文件, 或者加缓冲byte[]....
    public void readFiles(int num){
        for (int i = 0; i < num; i++) {
            reader_.readFile();
        }
    }

    //扩展readString ,批量处理字符串数据
    public void readString(int num) {
        for (int i = 0; i < num; i++) {
            reader_.readString();
        }
    }
}
